﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Uniriotec.DC.CoordDist.Base.Distribuida
{
    public partial class ExclusaoMutuaDistForm : Form
    {
        public ExclusaoMutuaDistForm()
        {
            InitializeComponent();
        }

        private void StartButton_Click(object sender, EventArgs e)
        {
            Start(5200, (int)this.numericUpDown1.Value);
        }

        void Start(int port, int num)
        {

            ProcessStarter.BasePort = port;

            for (int i = 1; i <= num ; i++)
            {
                MutualExclusionProcess proc = new MutualExclusionProcess();
                ProcessStarter.StartNew(num, i, proc);
            }
        }

    }
}